/*************************
* LEVEL LOADER
*************************/
function LevelLoader(level){
	
	var getRandom = function(min, max){
    	return Math.floor(Math.random() * (max - min + 1)) + min;
	};
	
	var maxLevel = 5;
	
	level = Math.min(maxLevel, level);
	var levelDef = [];
	var rows = 10;
	var cols = 10;
	
	for(var r=0; r < rows/2; r++)
	{
		for(var p=0; p < cols/2; p++)
		{
			levelDef[r*cols+p] = getRandom(0, level);
			levelDef[(r+1)*cols-p-1] = levelDef[r*cols+p];
		}
	}
	
	for(var i=0; i<rows*cols/2; i++)
	{
		levelDef[(rows*cols)-i-1] = levelDef[i];
	}
	
	return levelDef;
};

module.exports = LevelLoader;